home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_sol_fusecart.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  274 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SOL_FuseCart.cog
  4. #
  5. # Hey, there's a fuse in there!
  6. # fuse = 77
  7. #
  8. # [TRM]
  9. #
  10. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message     entered
  16.     message     exited
  17.     message     activated
  18.     message     pulse
  19.     
  20.     thing       player      local
  21.     thing       fuse        local
  22.     thing       indy        local
  23.     thing       door
  24.     thing       fuse1
  25.     thing       ghost
  26.     thing       interpCam
  27.     
  28.     surface     standHere
  29.     surface     orHere
  30.     
  31.     template    tplfuse=fusemove            local
  32.     template    tpl_Indy=indy_sh_actor      local
  33.     
  34.     sound       inOpened=inxj103.wav                    local   # ...it opened
  35.     sound       inSee=inxj001.wav                       local   # This looks interesting
  36.     sound       snd_Fuse=Inxj191.wav                    local   # a fifty amp fuse.
  37.     sound       snd_Open=sol_boxfuse_open.wav           local   # temp door open sound
  38.     #sound       snd_Land=sol_minecar_head_bonk_c.wav    local # temp fuse landing sound
  39.     
  40.     cog         talkCog             local
  41.     cog         hintCog
  42.     
  43.     int         done=0              local
  44.     int         saidIt=0            local
  45.     int         onIt=0              local
  46.     int         gotIt=0             local
  47.     
  48.     float       playery=0           local
  49.     float       playerx=0           local
  50.     
  51.     vector      camPos              local
  52.     vector      playerVec           local
  53.     
  54.     # ** subroutines **
  55.     flex        getFuse             local
  56.     flex        openDoor            local
  57.     
  58. end
  59.  
  60. # ========================================================================================
  61.  
  62. code
  63.  
  64. entered:
  65.     
  66.     player = GetLocalPlayerThing();
  67.     
  68.     if(done == 1) return;
  69.     
  70.     # if he's standing in the right orientation; do this
  71.     else if((GetSenderRef() == standHere) || (GetSenderRef() == orHere))
  72.     {
  73.         onIt = 1;
  74.         SetPulse(0.25);
  75.     }
  76.         
  77.     return;
  78.  
  79. # ========================================================================================
  80.  
  81. exited:
  82.  
  83.     player = GetLocalPlayerThing();
  84.     
  85.     if(done == 1) return;
  86.     
  87.     else if(GetSourceRef() == player)
  88.     {
  89.         if((GetSenderRef() == standHere) || (GetSenderRef() == orHere))
  90.         {
  91.             onIt = 0;
  92.             SetPulse(0.0);
  93.         }
  94.     }
  95.         
  96.     return;
  97.  
  98. # ========================================================================================
  99.  
  100. activated:
  101.     
  102.     player = GetLocalPlayerThing();
  103.     
  104.     if((GetSenderRef() == door) && (IsGhostVisible(player, door, 30.0)) && (done == 0) && (onIt == 1))
  105.     {
  106.         done = 1;
  107.         Call openDoor;
  108.     }
  109.     
  110.     else if((GetSenderRef() == fuse) && (gotIt == 0))
  111.     {
  112.         gotIt = 1;
  113.         Call getFuse;
  114.     }
  115.         
  116.     return;
  117.  
  118. # ========================================================================================
  119.  
  120. openDoor:
  121.  
  122.     # shut down pulse if player activated from side
  123.     saidIt = 1;
  124.     SetPulse(0.0);
  125.     
  126.     # do cutscene stuff
  127.     MakeMeStop();
  128.     StartCutscene(2);
  129.     
  130.     # move ext cam up and around player
  131.     SetExtCamOffsetToThing(interpCam);
  132.     
  133.     # put away any weapon
  134.     DeselectWeaponWait(player);
  135.     
  136.     # create indy actor
  137.     indy = CreateThing(tpl_Indy, player);
  138.     CaptureThing(indy);
  139.     
  140.     # outfit indy actor
  141.     CopyPlayerHolsters(player, indy);
  142.     
  143.     # hide player show indy
  144.     SetThingFlags(player, 0x80000);
  145.     ClearThingFlags(indy, 0x80000);
  146.     
  147.     # make indy look at the door
  148.     AISetLookThing(indy, door);
  149.     
  150.     # activate door
  151.     PlayMode(indy, 60, 0);
  152.     Sleep(0.3);
  153.     
  154.     # open door and drop the fuse
  155.     MoveToFrame(door, 1, 1.0);
  156.     PlaySoundThing(snd_Open, door, 1.0, 5, 10, 0);
  157.     Sleep(0.2);
  158.     PlayVoice(player, inOpened, 1.0, 0);
  159.     MoveToFrame(fuse1, 1, 2.5);
  160.     MoveToFrame(fuse1, 2, 2.5);
  161.     MoveToFrame(fuse1, 3, 2.5);
  162.     WaitForStop(fuse1);
  163.     #PlaySoundThing(snd_Land, fuse1, 0.25, 5, 10, 0);
  164.     Sleep(0.01);
  165.     DestroyThing(fuse1);
  166.     
  167.     # create item fuse
  168.     fuse = CreateThing(tplFuse, ghost);
  169.     CaptureThing(fuse);
  170.     
  171.     # take away door collision -- bug
  172.     SetCollideType(door, 0);
  173.     
  174.     # stop any unfinished animations
  175.     ResetThing(player);
  176.     
  177.     Sleep(1.0);
  178.     
  179.     # Get the player into position
  180.     CopyOrientAndPos(indy, player);
  181.     
  182.     # hide actor show player
  183.     SetThingFlags(indy, 0x80000);
  184.     ClearThingFlags(player, 0x80000);
  185.     
  186.     # restore camera
  187.     RestoreExtCam();
  188.     
  189.     # restore controls to player
  190.     ClearActorFlags(player, 0x200000);
  191.     
  192.     EndCutscene();
  193.     
  194.     return;
  195.  
  196. # ========================================================================================
  197.  
  198. getFuse:
  199.  
  200.     # solve hint3
  201.     SendMessage(hintCog, user0);
  202.     
  203.     # do cutscene stuff
  204.     MakeMeStop();
  205.     StartCutscene(0);
  206.     
  207.     # offset camera
  208.     SetExtCamOffsetToThing(interpCam);
  209.     
  210.     # put away any weapon
  211.     DeselectWeaponWait(player);
  212.     
  213.     Sleep(0.5);
  214.     
  215.     # pickup the fuse
  216.     PlayMode(player, 24, 0);
  217.     Sleep(0.4);
  218.     DestroyThing(fuse);
  219.     
  220.     # Call the Pickup Lines cog
  221.     talkCog = GetCogByIndex(0);
  222.     SendMessage(talkCog, 27);
  223.     
  224.     # sleep to wait for talkCog
  225.     Sleep(1.3);
  226.     
  227.     # add fuse to inventory
  228.     SetInvAvailable(player, 77, 1);
  229.     ChangeInv(player, 77, 1.0);
  230.     JonesInvItemChanged(77);
  231.         
  232.     # Johnny, tell the player what he's picked up
  233.     PlayVoice(player, snd_Fuse, 1.0, 1);
  234.     
  235.     #Sleep(1.0);
  236.     
  237.     # restore camera
  238.     RestoreExtCam();
  239.     
  240.     # restore player contrls
  241.     ClearActorFlags(player, 0x200000);
  242.     
  243.     EndCutscene();
  244.     
  245.     # restore door collision -- bug
  246.     SetCollideType(door, 3);
  247.     
  248.     return;
  249.     
  250. # ========================================================================================
  251.  
  252. pulse:
  253.  
  254.     playerVec = GetThingLVec(player);
  255.     playery = VectorY(playerVec);
  256.     playerx = VectorX(playerVec);
  257.  
  258.     if((saidIt == 0) && (onIt == 1))
  259.     {
  260.         if((playerx > 0) && ((playery > -0.7) && (playery < 0.7)))
  261.         {
  262.            saidIt = 1;
  263.            SetPulse(0.0);
  264.            PlayVoice(player, inSee, 1.0, 0);
  265.         }
  266.     }
  267.         
  268.     return;
  269.  
  270. # ========================================================================================
  271.  
  272. end
  273.  
  274.